<?php
namespace My\Model;

use Think\Model;

class ModelHouseConfigModel extends Model {
	
	protected $_auto = array(
			array('pic', 'getPic', self::MODEL_BOTH, 'callback'),
	);
	
	public function getPic() {
		if(!isset($_REQUEST['pic'])) return false;
		$pic = I("pic");
		$data = array();
		$pics = explode("|", $pic);
		foreach($pics as $v){
			$data[] = $v;
		}
		return serialize($data);
	}
	
	public function getConfigXML($config){
		$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<panorama id="">
  <view fovmode="0" pannorth="0">
    <start pan="0" fov="70" tilt="0"/>
    <min pan="0" fov="5" tilt="-90"/>
    <max pan="360" fov="120" tilt="90"/>
  </view>
  <userdata title="" datetime="2014:03:12 09:37:42" description="" copyright="" tags="" author="" source="" comment="" info="" longitude="" latitude=""/>
  <hotspots width="180" height="20" wordwrap="1">
    <label width="180" backgroundalpha="1" enabled="1" height="20" backgroundcolor="0xffffff" bordercolor="0x000000" border="1" textcolor="0x000000" background="1" borderalpha="1" borderradius="1" wordwrap="1" textalpha="1"/>
    <polystyle mode="0" backgroundalpha="0.2509803921568627" backgroundcolor="0x0000ff" bordercolor="0x0000ff" borderalpha="1"/>
  </hotspots>
  <media/>
  <input 
  		tile0url="{$config[1]}" 
  		prev5url="images/1_o_preview_5.jpg" 
  		prev4url="images/1_o_preview_4.jpg" 
  		prev3url="images/1_o_preview_3.jpg" 
  		prev2url="images/1_o_preview_2.jpg" 
  		prev1url="images/1_o_preview_1.jpg" 
  		prev0url="images/1_o_preview_0.jpg" 
  		tile5url="{$config[5]}" 
  		tilesize="750" 
  		tile4url="{$config[0]}" 
  		tile3url="{$config[4]}" 
  		tilescale="1.013333333333333" 
  		tile2url="{$config[3]}" 
  		tile1url="{$config[2]}" />
  <control simulatemass="1" lockedmouse="0" lockedkeyboard="0" dblclickfullscreen="0" invertwheel="0" lockedwheel="0" invertcontrol="1" speedwheel="1" sensitivity="8"/>
</panorama>
XML;
		return $xml;
	}
}